.\"
.\" This file and its contents are supplied under the terms of the
.\" Common Development and Distribution License ("CDDL"), version 1.0.
.\" You may only use this file in accordance with the terms of version
.\" 1.0 of the CDDL.
.\"
.\" A full copy of the text of the CDDL should have accompanied this
.\" source.  A copy of the CDDL is also available via the Internet at
.\" http://www.illumos.org/license/CDDL.
.\"
.\"
.\" Copyright 2015, Joyent, Inc. All rights reserved.
.\"
.Dd "Oct 16, 2015"
.Dt ZFD 4D
.Os
.Sh NAME
.Nm zfd
.Nd Zone file descriptor driver
.Sh DESCRIPTION
The
.Nm zfd
character driver exports devices into the zone which can be used by a
a standalone process within the zone as
.Vt stdin ,
.Vt stdout ,
and
.Vt stderr .
The
.Nm zfd
driver behaves in a similar manner as the
.Nm zcons(4D)
device.
Inside a zone, the slave side devices appear as
.Nm /dev/zfd/[0-4] .
.sp
The zone's zfd device configuration is driven by
.Nm zoneadmd
and a zone attribute
.Nm zlog-mode
which is somewhat of a misnomer since its purpose has evolved.
The attribute can have a variety of values, but the lowest two positions
in the value string are used to control how many zfd devices are created
inside the zone and if the primary stream is a tty.
.sp
.Dl --
.Dl -n
.Dl t-
.Dl tn
.sp
With the
.Nm t
flag set,
.Vt stdin ,
.Vt stdout ,
and
.Vt stderr ,
are multiplexed onto a single full-duplex stream which is configured as a tty.
That is,
.Nm ptem ,
.Nm ldterm
and
.Nm ttycompat
are autopushed onto the stream when the slave side is opened.
There is only a single zfd device (0) needed for the primary stream.
.sp
When the
.Nm n
flag is set, it is assumed that output logging will be done within the zone
itself.
In this configuration 1 or 2 additional zfd devices, depending on tty mode
.Nm ( t
flag), are created within the zone.
An application can then configure the zfd streams driver into a multiplexer.
Output from the stdout/stderr zfd(s) will be teed into the correspond
logging zfd(s) within the zone.
.Sh SEE ALSO
.Xr zlogin 1 ,
.Xr zcons 4D ,
.Xr zoneadmd 8 ,
.Xr zonecfg 8
